<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button id='btn'>登录</button>
  <button id='btn2'>获取数据</button>
</body>

</html>
<script>
  btn.onclick = function () {
    btn.onclick = function () {
      fetch('/login', {
        method: 'post',
        body: 'username=zf&psw=888',
        headers: {
          "content-type": "application/x-www-form-urlencoded"
        }
      }).then(res => res.json()).then(data => {
        console.log(data)
      })
    }
  }
  btn2.onclick = function () {

    fetch('/list', {
      method: 'post',
      body: 'qq=123&ee=888',
      headers: {
        "content-type": "application/x-www-form-urlencoded"
      }
    }).then(res => res.json()).then(data => {
      console.log(data)
    })
  }
</script>